#ifndef SYMBOL_XML_SERIALIZER_H
#define SYMBOL_XML_SERIALIZER_H

#include <QVector>
#include "Symbol.h"

QT_BEGIN_NAMESPACE
class QXmlStreamReader;
QT_END_NAMESPACE

class SymbolModel;

class SymbolXmlSerializer
{
public:
    
    SymbolXmlSerializer();
    ~SymbolXmlSerializer();
    
    bool loadFile( const QString & filename, SymbolModel * model );
    bool saveFile( const QString & filename, const SymbolModel * model );
    
    const QVector<Symbol> & getSymbolTable() const
    {
        return SymbolTable;
    }
    
private:

    SymbolXmlSerializer( const SymbolXmlSerializer & );
    SymbolXmlSerializer & operator=( const SymbolXmlSerializer & );
    
    void handleSymbols();
    
    void handleSymbol();
    
    QString readLeafNode();
    
    QXmlStreamReader
        * streamReader;
    QXmlStreamWriter
        * streamWriter;
    QVector<Symbol>
        SymbolTable;
    int
        CurrentNewIndex;

};

#endif